from  time import sleep
from selenium import webdriver
from selenium.webdriver.edge.service import Service
from selenium.webdriver.common.by import By
from lxml import etree

service = Service()
service.path = r'chromedriver.exe'
# 启动浏览器
browser = webdriver.Chrome(service=service)

# 让浏览器发起一个指定url对应请求
browser.get('https://i.qq.com/')

browser.switch_to.frame('login_frame')

switcher_plogin = browser.find_element(By.ID,'switcher_plogin')

sleep(2)

switcher_plogin.click()

uname = browser.find_element(By.ID,'u')
uname.send_keys('1175072')
pwd = browser.find_element(By.ID,'p')
pwd.send_keys('hefeng199010.')

login_button = browser.find_element(By.ID,'login_button')

login_button.click()

sleep(5)